package com.lanou.controller;

import com.lanou.entity.MyNotice;
import com.lanou.service.MyNoticeService;
import com.lanou.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName MyNoticeController
 * @Description TODO
 * @Author lizhenjiang
 * @Date 2025年08月15日 16:52
 * @Version 1.0
 */
@RestController
@RequestMapping("myNotice")
public class MyNoticeController {
    @Autowired
    private MyNoticeService myNoticeService;

    @PostMapping
    public R addMyNotice(@RequestBody MyNotice myNotice) {
        return R.ok(myNoticeService.addMyNotice(myNotice));
    }

    @GetMapping("getPages")
    public R getMyNotice(@RequestParam(value = "userId") Integer userId, @RequestParam(value = "pageNum",defaultValue = "1",required = false) Integer pageNum, @RequestParam(value = "pageSize",defaultValue = "10",required = false) Integer pageSize) {
        return R.ok(myNoticeService.getMyNotices(userId,pageNum,pageSize));
    }
}
